import request, { download } from '@/utils/request'

// 保养标准列表
export function getlevelList (query) {
  return request({
    url: '/function/upkeep/level/list',
    method: 'get',
    params: query
  })
}
// 保养标准修改状态
export function puttUpdatelevel (data) {
  return request({
    url: '/function/upkeep/level/changeStatus',
    method: 'put',
    data: data
  })
}
// 保养标准详情
export function getlevelChildren (query) {
  return request({
    url: `/function/upkeep/level/${query}`,
    method: 'get',
  })
}
// 设备部分信息列表
export function getEquipmentList (query) {
  return request({
    url: `/function/equipment/account/partInfo/list`,
    method: 'get',
    params: query
  })
}
// 保养类型
export function getUpkeepTypeList (query) {
  return request({
    url: '/function/upkeep/type/list',
    method: 'get',
    params: query
  })
}
// 新增保养类型
export function postCreatedUpkeep (data) {
  return request({
    url: '/function/upkeep/project',
    method: 'post',
    data: data
  })
}
// 修改保养类型
export function putCreatedUpkeep (data) {
  return request({
    url: '/function/upkeep/project',
    method: 'put',
    data: data
  })
}
// 查询保养项目列表
export function getUpkeepProjectList (query) {
  return request({
    url: '/function/upkeep/project/list',
    method: 'get',
    params: query
  })
}
// 新增保养标准
export function postCreatedUpkeepLevel (data) {
  return request({
    url: '/function/upkeep/level',
    method: 'post',
    data: data
  })
}
// 修改保养标准
export function putUpdateUpkeepLevel (data) {
  return request({
    url: '/function/upkeep/level',
    method: 'put',
    data: data
  })
}
// 修改保养类型状态
export function putUpdatechangeStatus (data) {
  return request({
    url: '/function/upkeep/type/changeStatus',
    method: 'put',
    data: data
  })
}
// 新增保养类型
export function postCreatedchangeType (data) {
  return request({
    url: '/function/upkeep/type',
    method: 'post',
    data: data
  })
}

// 修改保养类型
export function putUpdatechangeType (data) {
  return request({
    url: '/function/upkeep/type',
    method: 'put',
    data: data
  })
}
// 保养计划列表
export function getUpkeepPlantList (query) {
  return request({
    url: '/function/upkeep/plan/list',
    method: 'get',
    params: query
  })
}
// 修改保养计划状态
export function putUpdateplanChangeStatus (data) {
  return request({
    url: '/function/upkeep/plan/changeStatus',
    method: 'put',
    data: data
  })
}
// 审核流程
export function getSelectupkeepPlan (query) {
  return request({
    url: '/function/audit/upkeepPlan/list',
    method: 'get',
    params: query
  })
}

// 保养计划详情
export function getSelectChildrenPlan (query) {
  return request({
    url: '/function/upkeep/plan/' + query,
    method: 'get',
  })
}
// 保养计划详情设备
export function getSelectChildrenPlanEquipment (query) {
  return request({
    url: '/function/equipment/account/partInfo/list',
    method: 'get',
    params: query
  })
}

// 保养计划设备台账及其保养项目详情
export function getSelectChildrenandUpkeepProject (query) {
  return request({
    url: '/function/equipment/account/andUpkeepProject/' + query.equipmentAccountId + '/' + query.upkeepPlanId,
    method: 'get',
  })
}
// 验收方式字典列表
export function getdictList (query) {
  return request({
    url: '/system/dict/data/list',
    method: 'get',
    params: { ...query, dictType: 'acceptance_mode', status: 0 }
  })
}
// 申请保养计划
export function Createdplan (data) {
  return request({
    url: '/function/upkeep/plan',
    method: 'post',
    data
  })
}
// 与我相关列表
export function getSelectplanMyList (query) {
  return request({
    url: '/function/upkeep/plan/my/list',
    method: 'get',
    params: query
  })
}
// 审核
export function CommitAuditUpkeepPlan (data) {
  return request({
    url: '/function/audit/upkeepPlan',
    method: 'put',
    data
  })
}
// 计划明细列表
export function getSelectDetailList (query) {
  return request({
    url: '/function/upkeep/plan/equipment/detail/list',
    method: 'get',
    params: query
  })
}
// 保养任务列表
export function getSelectTaskList (query) {
  return request({
    url: '/function/upkeep/task/list',
    method: 'get',
    params: query
  })
}
// 保养详情（保养任务ID/设备台账ID）
export function getSelectChildrenupkeep (query, id) {
  return request({
    url: `/function/upkeep/task/` + query + '/' + id,
    method: 'get',
  })
}
// 我的保养任务列表
export function getSelectMinaTaskList (query) {
  return request({
    url: '/function/upkeep/task/my/list',
    method: 'get',
    params: query
  })
}

// 开始保养
export function putStartReplaceRecord (data) {
  return request({
    url: '/function/upkeep/task/status/start',
    method: 'put',
    data: data
  })
}
// 保养完成
export function putOriginCompleted (data) {
  return request({
    url: '/function/upkeep/task/status/completed',
    method: 'put',
    data: data
  })
}
// 我的保养任务列表
export function getSelectReplaceRecordList (query) {
  return request({
    url: '/function/equipment/consumable/replaceRecord/list',
    method: 'get',
    params: query
  })
}
// 验收完成
export function putAcceptanceCompleted (data) {
  return request({
    url: '/function/upkeep/task/status/acceptance/completed',
    method: 'put',
    data: data
  })
}
// 启用时修改循环起算日
export function putupkeepSpecifyTime (data) {
  return request({
    url: '/function/upkeep/plan/edit/specifyTime',
    method: 'put',
    data: data
  })
}
